using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

using Pronghorn.Core;

using TestDoubles;

namespace ViewEngine_Tests
{
	[TestFixture]
	public class FileSystemSkinLocator_Tests
	{
		#region Public Methods

		[Test]
		public void Gets_the_Assembly_name_for_this_view()
		{
			ISkinLocator locator = new FileSystemSkinLocator(StubControllerContext.CreateContext(StubControllerContextTypes.Home));
			string nameSpace = locator.GetAssemblyName();

			Assert.That(nameSpace, Is.EqualTo("pc.Skins.Default.Home.Index.dll"));
		}

		[Test]
		public void Gets_the_namespace_of_the_calling_assembly()
		{
			ISkinLocator locator = new FileSystemSkinLocator(StubControllerContext.CreateContext(StubControllerContextTypes.Home));
			string nameSpace = locator.GetNameSpace();

			Assert.That(nameSpace, Is.EqualTo("ViewEngine_Tests"));
		}

		[Test]
		public void Given_a_context_loads_the_skin()
		{
			ISkinLocator locator = new FileSystemSkinLocator(StubControllerContext.CreateContext(StubControllerContextTypes.Home));
			var list = locator.GetSkinLines();
			Assert.That(list.Count, Is.GreaterThan(0));
		}

		[Test]
		public void Given_a_context_returns_the_type()
		{
			ISkinLocator locator = new FileSystemSkinLocator(StubControllerContext.CreateContext(StubControllerContextTypes.Home));
			string typeName = locator.GetSkinType();

			Assert.That(typeName, Is.EqualTo("pc_Skins_Default_Home_Index"));
		}

		#endregion Public Methods
	}
}